StDemo Player 2.1 Copyright (c) 1993-1995 MIKSoft, Inc. -------------------------------- | MIKSoft, Inc. | | 37 Landsdowne Rd, | | East Brunswick, NJ 08816 | | USA | | Internet: mik@cnj.digex.com | | CompuServe: [74127,3671] | | Tel/Fax: (908) 390 8986 | -------------------------------- This package consists of the following files: ADDON.TXT - Description of StDemo Player Pro add-on FILE_ID.DIZ - StDemo Player short description. HIST.TXT - History of changes README.TXT - This file SAMPLE.BMP - Sample bitmap SAMPLE.WMF - Sample metafile SCRIPT.TXT - StDemo Player sample script SHOWBASC.WRI - Info on ShowBasic for Windows STDEMO.EXE - StDemo Player program STHOOK.DLL - StDemo Player DLL What is this? ============= StDemo Player is the multipurpose application. First of all, you can use it to create demos and tutorials. It allows you to write a script, which will start one or several Windows application and perform a series of keystrokes or mouse actions aimed to demonstrate these applications. While your script is being "played", you can disable completely keyboard and mouse, so that user will not be able to interfere with the running demo and to cause a conflict. At certain points of you script you may interrupt it in order to interact with user. These interactions allow: - to show the "text" box with some explanatory text before script will continue ( this is the main idea of how demos and tutorials are to be designed); - to show the "picture" box using bitmap or metafile before script will continue; - to show the "menu" box where user can select one of several choices, and therefore control the script's execution; - to show the "input" box, where user can answer questions and enter some text, which later can be used in script. There are many varieties of these boxes in order to make your demo flexible, and they can be forced to be shown in some convenient places on the screen. Moreover, user can move them across the screen to be able to see different parts of the covered windows. StDemo Player also allows you to play WAV files. Even if you are not interested in writing demos, you may find StDemo Player useful. For example, you can replace your complete Startup Group with the single StDemo Player script which will launch all your "startup" applications, and even perform some initial actions for every of them: set up default options, load files, etc. Another feature allows you to automate your everyday chores (like backup, etc. ) by using the scheduling abilities of StDemo Player script language. What is the Professional Edition of StDemo Player? ================================================== In "standard" version some keys are impossible to simulate (for example, pressing Alt alone, i.e. not as a modifier to some other key). Mouse simulations are limited to the client area of a window only. There are some other cases when mouse simulation wouldn't work, drag-and-drop from File Manager, for instance. StDemo Player Professional Edition doesn't impose limits on keyboard/mouse simulation. StDemo Recorder generates scripts which can be played only using Professional Edition of StDemo Player. Read the full description of the Professional Edition of StDemo Player in ADDON.TXT. Can I use StDemo Player in Windows 95? ====================================== Yes. StDemo Player Professional Edition for Windows 95 and Windows NT available now. Please contact us for current pricing information. What do I get when I register StDemo Player? ============================================ 1. The registered version of stdemo.exe without the "UNREGISTERED" stamp, and with your icons to be shown on dialog boxes instead of the "MIK" icon. (You'll need to send your icons to us). It is also possible to remove icons from dialog boxes completely. 2. StDemo Scrambler - the utility which allows to compress/scramble the source script. Registered version of StDemo Player will be able to recognize the scrambled/compressed script and play it as well as play the source script. Scrambling allows you to compress and distribute your script in the binary form, so that users will not be able to modify it. StDemo Scrambler is included with the site license only. 3. StDemo Recorder - the utility which allows automatic script recording and editing (keyboard and mouse simulation commands). You simply work with your application and all executed keyboard/mouse actions are recorded using StDemo script format. You can record small pieces of your demo one at a time, and combine them in your complete script later. StDemo Recorder is included with the Professional Edition site license only. How to play the script? ======================= When you run stdemo.exe without parameters, it looks for the file "script.txt" in the current working directory, and if it is there - "plays" it. Also you can pass the name of the script as a parameter to stdemo.exe. This name may include the full path. How to write a script? ====================== Script is a plain ASCII text file. It may include: - keystrokes; - commands; - interaction breaks; - comments. Every keystroke, command or interaction break is a unit. StDemo Player reads units from the script one by one and executes them. After one unit is executed, StDemo Player waits for some time (time-out tick, which can be set or changed at any point in the script) and then executes the next unit. Time-out doesn't affect the interaction breaks (which are "text", "picture", "menu" and "input" dialog boxes). Once one of this boxes is shown - only user may continue or stop script execution, selecting "Continue" or "Stop" button on the box. ( See below how to program "auto-continue" for interaction breaks.) Comments are ignored, as you may expect, and cause no time-out delays. 1. Keystrokes. -------------- Any text in the script which is not a command, interaction break or comment is a set of keystrokes, i.e. every symbol of the text causes a keystroke to be sent into the current window application (see below). There are also several special symbols which allow to simulate special different keyboard keys. Any keystroke can be preceded by one or more special symbols ("@" - Alt, "#" - Shift or/and "%" - Control) as you see in the following example: @A Alt-A #A Shift-A %A Ctrl-A #%A Shift-Ctrl-A There are also many special keys which are coded by "escaping" them with the "]". They are follows: ]| Down ]^ Up ]< Left ]> Right ]~ Tab ]! Return ]- PgUp ]+ PgDn ]\ Backspace ]Z Esc ]I Ins ]D Del ]H Home ]E End ]0 F10 ]1 F1 ........... ]9 F9 ]] ] ]@ @ ]% % ]# # ]: : ]$ $ This is not a full set of the keyboard keys, as you may note - but it covers the most usable ones (I hope). Using the Professional Edition of StDemo Player you are able to simulate any key, even the most exotic ones. ATTENTION: make sure that your lines with keystrokes do not have extra "unwanted" spaces at the end of the line - all spaces will be accepted and played as keystrokes. 2. Commands. ------------ All commands start from the colon sign ":". Some of the commands must be coded as a separate line in a script, others can be mixed with the keystrokes. The rule of a thumb is: if a command has fixed format or ends with the special separator - it can be placed anywhere, otherwise it has to be coded as a separate line of the script. The general format of a command is: : is a single letter or some other symbol; may vary; one parameter can be a letter, text or number; parameters follow the code without blank, and in some cases are separated one from another by the special separator "|". ATTENTION: I strongly recommend to use ":C11" and ":I11" commands at the beginning of your script, and remove them only after your script will be debugged and tested. Otherwise you are risking to lock up your system. The commands are: :Iab enable/disable Windows input; parameter "a" must be coded as one digit: 0 - disable input, 1 - enable input; parameter "b" is also 1 digit: 0 - temporarily, 1 - permanently. Example: :I10 enable input until the next interaction break. Note: When StDemo starts, it disables Windows input (keyboard and mouse buttons) in order to prevent user's intervention into the actions being played. When one of the interaction breaks occurs, the input is partially restored to allow user interaction inside the dialog box only. When script continues, the state is restored as it was before the break. "Temporarily change the state of Windows input" means "until the next interaction break occurs". Permanent change affects all subsequent commands and can be changed with the next ":I" command only. :Cab show/hide Windows cursor; parameter "a" must be coded as one digit: 0 - hide cursor, 1 - show cursor; parameter "b" is also 1 digit: 0 - temporarily, 1 - permanently. Example: :C11 show Windows cursor until further ":C" command. Note: When StDemo starts, it hides Windows cursor. When one of the interaction breaks occurs, the cursor is restored to allow user interaction inside the dialog box only. When script continues, the state is restored as it was before the break. "Temporarily change the visibility of cursor" means "until the next interaction break occurs". Permanent change affects all subsequent commands and can be changed with the next ":C" command only. :=x set time-out tick to x milliseconds. Default time-out is 1 millisecond. Example: :=1000 set time-out tick to 1 sec. :T skip 1 time-out tick. Example: abc:T:T:Tefg enter "abc", then wait for three current time-out ticks, then enter "efg". :Wx delay script execution for x seconds :Dtext change current directory to "text". Example: :Dc:\windows\system :(program_name parm|x launch the application; program name must include extension (for the security reason) and may include the full path; parameters to the program can be passed, if needed (not required); flag x may be coded as one digit 0..2 after the separator and affects the size of the application window: 0 (default), 1(maximize), 2(minimize). Note: By default, StDemo checks if the application created active window, and if not - assumes that something went wrong. This might create problems if the application you are going to start doesn't create window at all, or creates a hidden window. See :c command below which disables this check. Examples: :(notepad.exe :(c:\windows\write.exe demo.wri :(notepad.exe c:\stdemo\readme.txt|2 :cX enable/disable check on active window after the :( command; parameter "X" must be coded as one digit: 0 - disable check, 1 - enable check. : is "*" - it is treated as a "wildcard", i.e. any window with the caption which matches the "wildcarded" search string fits the search condition. Examples: :|f play the WAV file flag f may be coded as one digit 0..3 after the separator and affects the mode in which sound file is played: 0 (default) - synchronous mode; 1 - asynchronous mode (StDemo continues to run the following script commands without waiting for sound to finish; 2 - loop mode -- the sound will continue to play repeatedly until another :p command is executed; 3 - stop the currently playing sound (the is ignored for this mode, i.e. you may code the command as ":p|3"). :Alabel|m|h|w|d|t command allows to create "cron"-like scheduling of script execution. It triggers "goto label" operation if parameters match current date and time. Parameter are treated as: m - minutes (0 - 59), h - hours (0 - 23), w - day of week (1-7), d - day of a month (1-31), t - month (1-12). All parameters also can be coded as * ( any). If parameters do not match current day/time - the next command in a script will be executed. Example: :AReminder|30|9|*|9|8 goto label "Reminder" if today is August 9, 9:30am :ADump|00|22|*|*|* goto label "Dump" on any day 10:00pm :ASave|00|*|*|*|* goto label "Save" every 10 minutes :ASave|10|*|*|*|* :ASave|20|*|*|*|* :ASave|30|*|*|*|* :ASave|40|*|*|*|* :ASave|50|*|*|*|* Note: 1. Once :A command is executed - StDemo forgets about it. There is no internal loop in StDemo in order to check if current date/time matches some :A commands. It means that you have to provide your own loop inside a script if you are going to check this conditions repeatedly. 2. Be careful when after the successful execution of :A command you switch control back to the loop: if the same :A command will be executed again and conditions will match again - it might execute your code again several times (when you expect it to be run only once). Example: // main loop :Start :=1000 :ASave|00|*|*|*|* :GStart // // subroutine to execute "Save" :LSave (1) ................. :GStart (2) If you mean this script to execute "Save" once every hour - your results will depend on how long will it take to execute "save" subroutine. If it takes less than minute - next time :A will be executed it might branch to :LSave again. You may solve this problem by applying proper timing (use :=, :T, :U or :W commands) but the best solution is to use :~ command with the same date/time pattern which initiated your scheduled subroutine (look below). :Um|h|w|d|t command simplifies scheduling in some simple cases, it accepts the same parameters as :A command (except of label) and simply waits till current date/time will match given parameters. Be careful, do not program infinite (or almost) loops. :~m|h|w|d|t command has the same parameters as :U command and allows you to wait till current date/time will NOT match given parameters. The best use of this command is at the end of the scheduled subroutine (see :A above). Example: :C11 :I11 :=1000 // Main loop :LStart :=1000 :ABackup|0|4|*|*|* :ACloseBackup|0|7|*|*|* :ASendFax|30|16|*|*|* :ACloseFax|50|16|*|*|* // In case we want to terminate StDemo Player at this time :ATerminate|00|18|*|*|* :GStart // Backup subroutine :LBackup :DC:\backup :(backup.exe //.......... // send proper keystrokes to initiate backup //.......... :~0|4|*|*|* :GStart // Send fax subroutine :LSendFax :DC:\winword :(winword.exe report.doc //.......... // send proper keystrokes to initiate fax //.......... :~30|16|*|*|* :GStart :LCloseBackup : is "*" - it is treated as a "wildcard", i.e. any window with the caption which matches the "wildcarded" search string fits the search condition. Examples: :?Notepad - (Untitled)|FOUND_NOTEPAD :?Notepad*|found :va|b|c|d conditional branch depending on current Windows version: a - label for Windows 3.x and Windows for Workgroups b - label for Windows NT c - label for Windows 95 d - label for Win32s (meaning that 32-bit version of StDemo Player runs on Windows 3.x under Win32s subsystem). Example: :vW31|WNT|W95|W32S :Z :LW31 :#S Windows 3.x and Windows for Workgroups # :Z :LWNT :#S Windows NT # :Z :LW95 :#S Windows 95 # :Z :LW32S :#S Win32s # :Z :ya|b conditional branch depending on running StDemo Player version: a - label for 16-bit StDemo Player b - label for 32-bit StDemo Player Example: :yMe16|Me32 :Z :LMe16 :#S 16-bit version of StDemo Player # :Z :LMe32 :#S 32-bit version of StDemo Player # :Z ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The following commands are to be used when you want some mouse actions to be played from your script. It is not always possible to get a reliable results with the mouse actions, assuming that your script can be played with different display drivers in different Windows modes and display resolutions. In order to cope with this, you must use "virtual" coordinates, i.e. before using any command which has coordinates as a parameter, you have to set "virtual screen/window size" and then all following coordinates must be coded according to this size. When your script will be played, StDemo Player will determine the real current screen/window size, and then adjust all your virtual coordinates according to virtual/real ratio. You have to understand, that it is not a perfect solution - for example, dialog boxes sizes are not proportionally changed for different display resolutions, they depend on the size of the system font rather than on display mode. But if you code your mouse actions inside the dialog box, based on the dialog box virtual size - it will work. You may sometimes need to use absolute coordinates instead of virtual, define this in the :O command. :Sx|y set virtual screen/window size. Example: :S1024|768 :S100|50 :Oabc set coordinates origin. parameter "a" must be coded as one letter: S - screen, A - application main window, F - current focus window; parameter "b" is also 1 letter: C - client area, W - window area. parameter "c" is also 1 letter: V - virtual coordinates (default), A - absolute coordinates. Examples: :OSWV :OACA :OFW :Mx|y|n move mouse cursor to (x,y) in n steps. Examples: :S200|200 :OAC :C11 :M100|100|1 set cursor in the center of the client area of the main application window. :M0|200|100 move cursor in 100 steps to the bottom-left corner of the client area. Note: Make sure that your coordinates agree with the current modes set in ":S" and ":O" commands. :Bab mouse button action. parameter "a" must be coded as one letter: L - left button, R - right button, M - middle; parameter "b" must be coded as 1 digit: 1 - press, 0 - release, 2 - double-click. Note: This command affects only client-area of a window. You cannot simulate mouse-clicks in non-client area using this command. :Kab set keyboard state for some special keys. parameter "a" must be coded as one letter: S - Shift key, C - Control key, A - Alt key, I - Ins key; parameter "b" must be coded as 1 digit: 1 - down, 0 - up. Example: :KS1:BL1:BL0:KS0 click the left mouse button when the Shift key is down. 3. Interaction breaks. ---------------------- These are various dialog boxes which can be shown at any point of you script, allowing therefore some interaction with user. There are three classes of these boxes: "text", "menu" and "input". Each class contains from 3 to 5 similar boxes, which vary by their size and by the number of fields in them. All boxes are coded in the script differently, but the common pattern is:
3.1 TEXT interaction break. +++++++++++++++++++++++++++ Every TEXT box has a single text field which fills the dominant area of the box. The header line is: :#sxy parameter "s" defines the size and must be a letter: S - small, M - medium, L - large, W - wide, N - narrow; (optional, default is L) parameter x defines the position along the x-axis: L - left adjusted, C - centered, R - right adjusted; (optional, default is C) parameter y defines the position along the y-axis: U - up adjusted, C - centered, D - down adjusted. (optional, default is C) parameter defines the size of the text field of the dialog box in pixels (this parameter is optional). The format is [w|h] where w is the width of the text field, and h is the height. Square brackets and separator must be coded as shown. If parameter is coded, the parameter is ignored. The body of this break consists from the text only, which will be shown in the single text field of the box. Text may be coded as one or more lines in the script, but it'll be placed continuously in the box, applying word wrap. There are two special commands which can be entered into the body of the TEXT box: .N causes the following text start from a new line in a box; .S allows to skip one line and continue to fill a box with the following text. The delimiter line is: # Example: :#NCC This is the narrow box, centered on the screen. .S This text starts after the empty line. .N This text starts from the beginning of the new line. # Notes: 1. The amount of text you can place into the text box depends on the current display mode ( VGA, SVGA, etc. ) and fonts supported by your current display driver. This creates a problem: the text you placed into the box might not fit when you run your demo on a different system. In order to make sure, that it will not happen, StDemo Player checks if the whole text fits into the box, and if not - it is trying to reduce the font size, until the whole text fits. If the system doesn't have a small enough font - the scroll bar will be added to the text field, so that user can read the whole text by scrolling it. 3.2 PICTURE interaction break. ++++++++++++++++++++++++++++++ Every PICTURE box has a single picture field which fills the dominant area of the box. The header line is: :#xy parameter x defines the position along the x-axis: L - left adjusted, C - centered, R - right adjusted; (optional, default is C) parameter y defines the position along the y-axis: U - up adjusted, C - centered, D - down adjusted. (optional, default is C) parameter defines the size of the picture in the dialog box in pixels (this parameter is optional). The format is [w|h] where w is the width of the picture, and h is the height. Square brackets and separator must be coded as shown. The body of this break has 1 line. This line defines the image file which will be shown in the picture box. The filename may contain the full path. The following file formats are supported: - Windows MetaFile (plain and placeable) (*.wmf); - Windows Metafile in clipboard format (*.clp); - Windows Bitmap up to 256 colors (*.bmp); - Windows device independent bitmap up to 256 colors (*.dib); - Windows RLE (run-length encoded) bitmap up to 256 colors (*.rle). The delimiter line is: # Example: :@CC simple.bmp @ :@LU[450|300] c:\pictures\worm.wmf @ Notes: 1. By default, StDemo uses the picture's native size and adjusts the dialog box size automatically. You can override this using the second line in the body of the picture break. The bitbap in this case will be stretched to the given size. If, however, the default (native) or given size is less then the minimal one ( to fit dialog box bottons and icons) - the picture will be shown in the dialog box inside the rectangle painted with the current background color ( see :b command). 3.3 MENU interaction break. +++++++++++++++++++++++++++ Every MENU box has a header text field on a top and from 2 to 9 menu item fields ( radio buttons). The header line is: :*sxy parameter "s" defines the size and must be a letter: S - small, M - medium, L - large; parameter x defines the position along the x-axis: L - left adjusted, C - centered, R - right adjusted; (optional, default is C) parameter y defines the position along the y-axis: U - up adjusted, C - centered, D - down adjusted. (optional, default is C) The body of this break consists from the text which will fill the header text field of the menu box, and two or more menu lines. Text may be coded as one or more lines anywhere in the body; it'll be placed continuously in the header field, using word wrap if appropriate. Text line should not start from a digit. Every menu item line has the following format: nlabel|item text "n" is a menu item field number (1..9); "label" - is a label in the script where control will be passed if this item will be selected from the menu box. "item text" is a text to fill the menu item field. The delimiter line is: * Notes: 1. The "small" menu box has 2 menu fields, the "medium" - 5 fields, and the large - 9 fields. 2. If there is no text for the header - the header field will not be shown in the box. 3. If there is no lines for some menu items - the correspondent item field will not be shown in the box. Example: :*MCU Select one of the three: 1l1|This is the first item 3l2|This is the second item 5l3|This is the third item * :Ll1 :#SCC You've selected the first. # :Gcont :Ll2 :#SCC You've selected the second. # :Gcont :Ll3 :#SCC You've selected the third. # :Lcont 3.4 INPUT interaction break. ++++++++++++++++++++++++++++ Every INPUT box has a header text field on a top of the box and from 1 to 9 edit fields. The small box has only one edit field, the medium has 5, and the large has 9. Every edit field in the medium and large INPUT boxes has the correspondent description field on a left of the every edit field. The header line is: :%sxy parameter "s" defines the size and must be a letter: S - small, M - medium, L - large; parameter x defines the position along the x-axis: L - left adjusted, C - centered, R - right adjusted; (optional, default is C) parameter y defines the position along the y-axis: U - up adjusted, C - centered, D - down adjusted. (optional, default is C) The body of this break consists from the text which will fill the header text field of the menu box, and one or more input lines. Text may be coded as one or more lines anywhere in the body; it'll be placed continuously in the header field, using word wrap if appropriate. Text line should not start from a digit. Every input line has the following format: nDescription_Text "n" is a input field number (1..9); the correspondent input field will be filled with the current value of the variable $n. If the variable is empty - the field will also be empty. "Description_Text" is a text to fill the description field for the "n"- th input field. The delimiter line is: % Notes: 1. The "small" input box has 1 edit field, the "medium" - 5 fields, and the large - 9 fields. 2. If there is no text for the header - the header field will not be shown in the box. 3. If there is no line for some edit field - the correspondent edit and description fields will not be shown in the box. 4. After user entered some text in the input field - this text will be assigned to the correspondent variable ($1..$9). Example: :(notepad.exe|1 :$2John :%MCU Please correct your name. 2Your first name: 4Your last name: % Hello, $2 $4! :#SRD Is my greeting correct? # :) 4. Comments. ------------ Any line in the script outside the interaction breaks, which starts from "//" is being treated as a comment. Registration. ============ StDemo Player is shareware. The registration of a single license will entitle you to use ONE copy of StDemo Player. Read about the Pro version in "addon.txt". Site license allows to redistribute StDemo run-time royalty free. ----------------------------------------------------------------- | V E R S I O N ----------------------------------------------------------------- License | Standard (w/src) | Professional (w/src) ----------------------------------------------------------------- Single | $30 $60 Site | $300 ($600) $500 ($900) ----------------------------------------------------------------- To register by mail, please send check or money order to: MIKSoft, Inc. 37 Landsdowne Rd, East Brunswick, NJ 08816 USA Please, make checks payable to MIKSoft, Inc. To register using Visa/MasterCard please call (908)390-8986 (site licenses only). To register on CompuServe, GO SWREG and find StDemo (registration ID is 3276) The price to register on CompuServe is higher to cover CompuServe's charges: $35 for a single license and the rest accordingly. To register Pro or site license on CompuServe, simply register several copies according to the following table: ----------------------------------------------------------------- | V E R S I O N ----------------------------------------------------------------- License | Standard (w/src) | Professional (w/src) ----------------------------------------------------------------- Single | 1 copy 2 copies Site | 10 copies(20 copies) 16 copies (30 copies) ----------------------------------------------------------------- After registering by SWREG, please let us know via CompuServe mail what kind of registration is that. When you register, I will replace irrelevant "MIK" icon on all dialog boxes to another one (you may send your icon to me), remove "UNREGISTERED" stamp from these dialog boxes and will send the updated copy to you along with the compression/scrambling utility (if you register the site license) and StDemo Recorder (if you register the Professional Edition site license). Technical Support ================= Technical support is free for registered users via e-mail. We also welcome comments, questions and suggestions. Contact us at: Internet: mik@cnj.digex.com CompuServe: [74127,3671] Shareware Version Distribution ============================== You can make copies of shareware (unregistered) version of this program and give them to others as long as all files are included and unaltered. Disclaimer. =========== I've taken great care to ensure the program performs as stated. Still, I cannot guarantee this will be the case on every system. As such, you agree NOT to hold me responsible for ANY damages directly or indirectly related to the use of Stdemo Player. The author of this software is not responsible for any damage due to use of this program. This software is provided without warrantee of any kind. Known Problems. =============== StDemo might misbehave if it is running together with ALL3D package which forces all dialog boxes to have 3-D look provided by CTL3D.DLL Script.txt runs up to 2 instances of Paintbrush, which eats a lot of memory from the system heap. Make sure you have sufficient amount of virtual memory available. Acknowledgments. ================ 1. Thanks to CompuServe and all participants of the WinSdk forum - you were my teachers, when I started programming Windows. 2. Thanks to Brent Rector, whose book "Developing Windows 3 Applications" (and once he personally) helped me along my way of learning Windows. 3. Thanks to my friends Ken Winston and Michael Markov; their enthusiasm kept me busy enough to grow. A Personal Note... ================== I write C better than English. Please excuse my mistakes and funny constructions in the above text, if you noted some (I'm sure, you did!). Especially articles... They are incomprehensible! Thanks!